Object Text Update

Hi,

Help needed, I have three attributes:

Object Text, Attribute1, Attribute2

Object Text = The car shall not go faster than "?".
Attribute1 = 65
Attribute2 = MPH

What I need to do is update the object text wherever there is the question mark symbol to the data that is in attribute1 and attribute2.

This should happen automatically everytime Attribute1 and Attribute2 is filled, Object Text should read:

The car shall not go faster than 65 MPH.

Could this be done using dxl? I'm guessing I need to have a trigger, does anyone have any suggestions on how I can go about doing this?

Any help will be much appreciated.

Thanks!!!
SystemAdmin - Fri Jul 06 07:51:44 EDT 2012

Re: Object Text Update
llandale - Fri Jul 06 11:22:28 EDT 2012

First off, if you change "Object Text" to "bla bla 65mph", then it no longer contains "?" and future changes to "70" won't be made. Perhaps you need a 4th attribute "Generic Requirement" that contains your "?" phrase, and "Object Text" is a function of the other 3.

A post-save-attribute trigger should work.
-If the attribute is not one of the two I like then halt
-If Generic Requirement does not contain "?" then halt
-If I cannot write to Object Text then halt
-Get Generic Requirement
-Replace "?" with a combination of the two.
-Set to Object Text

The "Replace" is tricky unless you are SURE your text does not contain rich text. Search for "replaceRichText" in the forums for how to replace a raw string inside a rich string.

Since Triggers can be by-passed, you will need some form of administration on-demand script that scans the modules and updates Object Text in the same way. So write that first, checking and updating all objects in a module. Once you are happy with that, you may find you really do not want to plung in the Abyss called "Triggers". Only the bravest lions go there.

-Louie

Re: Object Text Update
Mike_Peters - Tue Jul 10 11:21:00 EDT 2012

llandale - Fri Jul 06 11:22:28 EDT 2012
First off, if you change "Object Text" to "bla bla 65mph", then it no longer contains "?" and future changes to "70" won't be made. Perhaps you need a 4th attribute "Generic Requirement" that contains your "?" phrase, and "Object Text" is a function of the other 3.

A post-save-attribute trigger should work.
-If the attribute is not one of the two I like then halt
-If Generic Requirement does not contain "?" then halt
-If I cannot write to Object Text then halt
-Get Generic Requirement
-Replace "?" with a combination of the two.
-Set to Object Text

The "Replace" is tricky unless you are SURE your text does not contain rich text. Search for "replaceRichText" in the forums for how to replace a raw string inside a rich string.

Since Triggers can be by-passed, you will need some form of administration on-demand script that scans the modules and updates Object Text in the same way. So write that first, checking and updating all objects in a module. Once you are happy with that, you may find you really do not want to plung in the Abyss called "Triggers". Only the bravest lions go there.

-Louie

Hi,

I also need to do this, I'm new to DXL, is there an example or a starting point I can use to begin this task?

Thanks in advance for the help you can give.

Mike

Re: Object Text Update
SystemAdmin - Wed Jul 18 12:02:45 EDT 2012

llandale - Fri Jul 06 11:22:28 EDT 2012
First off, if you change "Object Text" to "bla bla 65mph", then it no longer contains "?" and future changes to "70" won't be made. Perhaps you need a 4th attribute "Generic Requirement" that contains your "?" phrase, and "Object Text" is a function of the other 3.

A post-save-attribute trigger should work.
-If the attribute is not one of the two I like then halt
-If Generic Requirement does not contain "?" then halt
-If I cannot write to Object Text then halt
-Get Generic Requirement
-Replace "?" with a combination of the two.
-Set to Object Text

The "Replace" is tricky unless you are SURE your text does not contain rich text. Search for "replaceRichText" in the forums for how to replace a raw string inside a rich string.

Since Triggers can be by-passed, you will need some form of administration on-demand script that scans the modules and updates Object Text in the same way. So write that first, checking and updating all objects in a module. Once you are happy with that, you may find you really do not want to plung in the Abyss called "Triggers". Only the bravest lions go there.

-Louie

Thank you Llandale, sorry for not responding earlier I was on vacation.

I will follow your recommendations, however, how will I keep Object Text updated by future changes in the "value" ex. if:("bla bla 65mph" changes to "bla bla 70mph" from the "Generic Requirements" attribute?

Re: Object Text Update
llandale - Wed Jul 18 13:33:19 EDT 2012

SystemAdmin - Wed Jul 18 12:02:45 EDT 2012
Thank you Llandale, sorry for not responding earlier I was on vacation.

I will follow your recommendations, however, how will I keep Object Text updated by future changes in the "value" ex. if:("bla bla 65mph" changes to "bla bla 70mph" from the "Generic Requirements" attribute?

You write a DXL that takes the master 4th attribute and this value attribute, and controls the value of Object Text.
Object Text = Master Attr, replacing "?" with the parameter.

MasterAttr = "Crusing speed of vehicle is ?mph"
ParamAttr = "65"
Object Text becomes "Crusing speed of vehicle is 65mph"

Change ParamAttr = 70
Now Object Text becomes "Crusing speed of vehicle is 65mph"

Change MasterAttr = "Crusing speed of the car is ?mph"
Now Object Text becomes "Crusing speed of the car is 70mph"

-Louie

Having said that, I have some serous conserns about putting your actual CM requirements into a secondary attribute. I think I would do it the other way, Object text is generic containing "?" and formal reports display the combo attr changing it to "70". Then Object Text retains its primacy for CM etc. This has the rather distinct advantage that your single spec can handle the requirement for multiple platforms. Object Text is "goes ?mph". AttrSedan1 = "65". AttrSUV2 = "60". You have 2 different target attrs, "Reqs for Sedan1" says 65, Reqs for SUV2 says 60.

Re: Object Text Update
llandale - Wed Jul 18 13:35:30 EDT 2012

llandale - Wed Jul 18 13:33:19 EDT 2012
You write a DXL that takes the master 4th attribute and this value attribute, and controls the value of Object Text.
Object Text = Master Attr, replacing "?" with the parameter.

MasterAttr = "Crusing speed of vehicle is ?mph"
ParamAttr = "65"
Object Text becomes "Crusing speed of vehicle is 65mph"

Change ParamAttr = 70
Now Object Text becomes "Crusing speed of vehicle is 65mph"

Change MasterAttr = "Crusing speed of the car is ?mph"
Now Object Text becomes "Crusing speed of the car is 70mph"

-Louie

Having said that, I have some serous conserns about putting your actual CM requirements into a secondary attribute. I think I would do it the other way, Object text is generic containing "?" and formal reports display the combo attr changing it to "70". Then Object Text retains its primacy for CM etc. This has the rather distinct advantage that your single spec can handle the requirement for multiple platforms. Object Text is "goes ?mph". AttrSedan1 = "65". AttrSUV2 = "60". You have 2 different target attrs, "Reqs for Sedan1" says 65, Reqs for SUV2 says 60.

Now that I think even more, I'd retain Object Text with the "?" and use the target Requirement to be just an Attr-DXL, displaying the combination of Text and the Paramter values. Be sure to export THAT attr for folks who need to see the requirement.

Re: Object Text Update
SystemAdmin - Thu Jul 19 14:59:07 EDT 2012

llandale - Wed Jul 18 13:35:30 EDT 2012
Now that I think even more, I'd retain Object Text with the "?" and use the target Requirement to be just an Attr-DXL, displaying the combination of Text and the Paramter values. Be sure to export THAT attr for folks who need to see the requirement.

Thank you Louie,

I understood everything except for how does the MasterAttr retain the "?" after it's been replaced by a value? or is it that it never loses "?" didn't understand that part. I believe if the MasterAtt "?" is replaced then Object Text does not update becuase MasterAtt loses "?".

Re: Object Text Update
llandale - Fri Jul 20 09:11:13 EDT 2012

SystemAdmin - Thu Jul 19 14:59:07 EDT 2012
Thank you Louie,

I understood everything except for how does the MasterAttr retain the "?" after it's been replaced by a value? or is it that it never loses "?" didn't understand that part. I believe if the MasterAtt "?" is replaced then Object Text does not update becuase MasterAtt loses "?".

Presuming the standard case where your module has one program's requirements:
  • Object Text: contains Text and parameter place holder "?"
  • ParameterValue: contains the parameter value
  • dxlActualRequirement: display Object Text with the place holder replaced with the Parameter value
    • string Text = obj."Object Text"
    • string PValue = probeAttr_(obj, "ParameterValue")
    • if (null PValue or Text does not contain '?') //
    • then Result = Text
    • else Result = replace '?' with PValue
    • obj.attrDXLName = Result
e.g.
  • Object Text: The car shall cruise at ?mph.
  • ParameterValue: 60
  • dxlActualRequirement: The car shall cruise at 60mph.

If you want to change the speed you cut a CP against "ParameterValue", leaving "Object Text" unchanged.

For exporting purposes (which must look like a "spec"), you will need to contrive a "dxlActualHeading" that, if the object is a heading, displays the paragraph number along with the Heading, with clever bolding.

Now presuming the complicated case where you want the module to house multiple programs' requirements, you will want attributes:
  • ProgramApplicability: Multi-Enumerated of each program, selecting means the requirement applies to that program; "Prog1", "Prog2", "Prog3"
  • Object Text
  • Prog1_Parameter; Prog2_Parameter...
  • dxlProg1_Requirement; dxl_Prog2_Requirement
    • string Program = attrDXLName[3:7] // the "Prog1" out of "dxlProg1_..."
    • string ParamAttr = Program "_Parameter // e.g. "Prog1_Parameter"
    • string Text = obj."Object Text"
    • string PValue = probeAttr_(obj, "ParameterValue")
    • if (!isMember("ProgramApplicability", Program))
    • then Result = "" // This req doesn't apply to this program
    • elseif (null PValue or Text does not contain '?') //
    • then Result = Text
    • else Result = replace '?' with PValue
    • obj.attrDXLName = Result

The place holder should be an extremely unlikely string like "<<Param>>". "?" can occur naturally in the text.

-Louie

Yes this is real complicated and I'm sure I haven't thought of everything.

Our partner's did something like this, where "shall cruise at ?" was unclassified, and they kept the classified parameters hidden away in the classified system. Their "?" was replaced with a specific parameter reference like "<<ClassParam_0037>>".

Re: Object Text Update
SystemAdmin - Fri Jul 20 11:43:06 EDT 2012

llandale - Fri Jul 20 09:11:13 EDT 2012
Presuming the standard case where your module has one program's requirements:

  • Object Text: contains Text and parameter place holder "?"
  • ParameterValue: contains the parameter value
  • dxlActualRequirement: display Object Text with the place holder replaced with the Parameter value
    • string Text = obj."Object Text"
    • string PValue = probeAttr_(obj, "ParameterValue")
    • if (null PValue or Text does not contain '?') //
    • then Result = Text
    • else Result = replace '?' with PValue
    • obj.attrDXLName = Result
e.g.
  • Object Text: The car shall cruise at ?mph.
  • ParameterValue: 60
  • dxlActualRequirement: The car shall cruise at 60mph.

If you want to change the speed you cut a CP against "ParameterValue", leaving "Object Text" unchanged.

For exporting purposes (which must look like a "spec"), you will need to contrive a "dxlActualHeading" that, if the object is a heading, displays the paragraph number along with the Heading, with clever bolding.

Now presuming the complicated case where you want the module to house multiple programs' requirements, you will want attributes:
  • ProgramApplicability: Multi-Enumerated of each program, selecting means the requirement applies to that program; "Prog1", "Prog2", "Prog3"
  • Object Text
  • Prog1_Parameter; Prog2_Parameter...
  • dxlProg1_Requirement; dxl_Prog2_Requirement
    • string Program = attrDXLName[3:7] // the "Prog1" out of "dxlProg1_..."
    • string ParamAttr = Program "_Parameter // e.g. "Prog1_Parameter"
    • string Text = obj."Object Text"
    • string PValue = probeAttr_(obj, "ParameterValue")
    • if (!isMember("ProgramApplicability", Program))
    • then Result = "" // This req doesn't apply to this program
    • elseif (null PValue or Text does not contain '?') //
    • then Result = Text
    • else Result = replace '?' with PValue
    • obj.attrDXLName = Result

The place holder should be an extremely unlikely string like "<<Param>>". "?" can occur naturally in the text.

-Louie

Yes this is real complicated and I'm sure I haven't thought of everything.

Our partner's did something like this, where "shall cruise at ?" was unclassified, and they kept the classified parameters hidden away in the classified system. Their "?" was replaced with a specific parameter reference like "<<ClassParam_0037>>".

Thank you so much for your quick response and your thorough explanation.

All put all of this to work and let you know how it all turns out.

Re: Object Text Update
dbinkis - Fri Jul 20 13:15:30 EDT 2012

llandale - Fri Jul 20 09:11:13 EDT 2012
Presuming the standard case where your module has one program's requirements:

  • Object Text: contains Text and parameter place holder "?"
  • ParameterValue: contains the parameter value
  • dxlActualRequirement: display Object Text with the place holder replaced with the Parameter value
    • string Text = obj."Object Text"
    • string PValue = probeAttr_(obj, "ParameterValue")
    • if (null PValue or Text does not contain '?') //
    • then Result = Text
    • else Result = replace '?' with PValue
    • obj.attrDXLName = Result
e.g.
  • Object Text: The car shall cruise at ?mph.
  • ParameterValue: 60
  • dxlActualRequirement: The car shall cruise at 60mph.

If you want to change the speed you cut a CP against "ParameterValue", leaving "Object Text" unchanged.

For exporting purposes (which must look like a "spec"), you will need to contrive a "dxlActualHeading" that, if the object is a heading, displays the paragraph number along with the Heading, with clever bolding.

Now presuming the complicated case where you want the module to house multiple programs' requirements, you will want attributes:
  • ProgramApplicability: Multi-Enumerated of each program, selecting means the requirement applies to that program; "Prog1", "Prog2", "Prog3"
  • Object Text
  • Prog1_Parameter; Prog2_Parameter...
  • dxlProg1_Requirement; dxl_Prog2_Requirement
    • string Program = attrDXLName[3:7] // the "Prog1" out of "dxlProg1_..."
    • string ParamAttr = Program "_Parameter // e.g. "Prog1_Parameter"
    • string Text = obj."Object Text"
    • string PValue = probeAttr_(obj, "ParameterValue")
    • if (!isMember("ProgramApplicability", Program))
    • then Result = "" // This req doesn't apply to this program
    • elseif (null PValue or Text does not contain '?') //
    • then Result = Text
    • else Result = replace '?' with PValue
    • obj.attrDXLName = Result

The place holder should be an extremely unlikely string like "<<Param>>". "?" can occur naturally in the text.

-Louie

Yes this is real complicated and I'm sure I haven't thought of everything.

Our partner's did something like this, where "shall cruise at ?" was unclassified, and they kept the classified parameters hidden away in the classified system. Their "?" was replaced with a specific parameter reference like "<<ClassParam_0037>>".

> llandale wrote:
> For exporting purposes (which must look like a "spec"), you will need to contrive a "dxlActualHeading" that, if the object is a heading, displays the paragraph number along with the Heading, with clever bolding.

Alternatively, I would just modify the "wordDumpBodyVBA(Object o)" method in word.dxl to point to the DXL attribute for the body text. It would be a much simpler change then trying to come up with a clever scheme to replicate the Object Header style/numbers/etc.

Re: Object Text Update
llandale - Sat Jul 21 16:35:24 EDT 2012

dbinkis - Fri Jul 20 13:15:30 EDT 2012
> llandale wrote:
> For exporting purposes (which must look like a "spec"), you will need to contrive a "dxlActualHeading" that, if the object is a heading, displays the paragraph number along with the Heading, with clever bolding.

Alternatively, I would just modify the "wordDumpBodyVBA(Object o)" method in word.dxl to point to the DXL attribute for the body text. It would be a much simpler change then trying to come up with a clever scheme to replicate the Object Header style/numbers/etc.

If Object Text remains generic and contains "?", then you cannot export the "Main" column; which means you need to simulate a "Main" column which requires simulating the ParagraphNumber - Heading Text combination you see in the main column.

There may be some benefit to updating your deployed Exporter as well. But I seem to have a serious mental block against having procedures that require all client installs to be tailored. Some folks here have claimed success but it seems like a CM nightmare. Heck, we cannot even get all the Clients at the same installed version.

-Louie